﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace politicsWorks.UserControls
{
    public partial class UC_home : UserControl
    {
        private FormMain.Problem[] problems;
        private int RightNum = 0;
        private int WrongNum = 0;
        private int CompleteNum = 0;
        public UC_home(FormMain.Problem[] problems)
        {
            InitializeComponent();
            this.problems = problems;
            CountProblems();
            ShowNum();
            
        }

        public void CountProblems()
        {
            foreach (FormMain.Problem problem in problems)
            {
                if (problem.result == 1)    //right
                {
                    RightNum++;
                    CompleteNum++;
                }
                else if (problem.result == 2)
                {
                    WrongNum++;
                    CompleteNum++;
                }

            }
        }

        public void ShowNum()
        {
            labelRight.Text = RightNum.ToString();
            labelWrong.Text = WrongNum.ToString();
            labelComplete.Text = CompleteNum.ToString();
        }
    }
}
